import { Component, Input, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { InputBoolean } from '../core/utils/convert';

@Component({
  selector: '[lv-icon]',
  exportAs: 'lvIcon',
  templateUrl: './icon.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  host: {
    '[class.lv-icon-host]': 'true',
    '[class.lv-icon-color-state]': 'lvColorState',
    '[attr.disabled]': 'lvDisabled === "" || lvDisabled ? "" : null',
  },
})
export class IconComponent {
  @Input('lv-icon') lvId: string;

  @Input('lvDisabled') lvDisabled: boolean | string = false;

  // 颜色是否随着状态变化
  @Input('lvColorState') @InputBoolean() lvColorState: boolean = false;
}
